package com.JUtils.socket;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class SocketServer {

    public static void main(String[] args) throws Exception {
        ServerSocket serverSocket = new ServerSocket(8888);
        Socket socket = serverSocket.accept();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String request;
        PrintWriter out =
                new PrintWriter(socket.getOutputStream(), true);
        while ((request = bufferedReader.readLine()) != null) {
            if ("Done".equals(request)) {
                break;
            }
            System.out.println(request);
            out.println("ok");
        }
    }

}
